package com.gexiaobao.pigeon.ui.adapter

import androidx.appcompat.widget.AppCompatImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.gexiaobao.pigeon.R
import com.gexiaobao.pigeon.app.base.DataBindBaseViewHolder
import com.gexiaobao.pigeon.app.model.bean.VideoFifteenBean
import com.gexiaobao.pigeon.app.util.ImageLoaderManager
import com.gexiaobao.pigeon.databinding.ItemFifteenVideoPlayBinding

/**
 * @Author      : hxw
 * @Date        : 2024/9/2 10:28
 * @Describe    :
 */
class VideoFifteenAdapter(data: ArrayList<VideoFifteenBean>) :
    BaseQuickAdapter<VideoFifteenBean, DataBindBaseViewHolder>(R.layout.item_fifteen_video_play, data) {
    override fun convert(holder: DataBindBaseViewHolder, item: VideoFifteenBean) {
        val binding = DataBindBaseViewHolder.getBinding(holder) as ItemFifteenVideoPlayBinding
        binding.data = item
        binding.executePendingBindings()//防止列表抖动

        val ivItemFifteenCover = holder.getView<AppCompatImageView>(R.id.ivItemFifteenCover)
        ImageLoaderManager.loadImage(context, item.video, ivItemFifteenCover)
    }
}